<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name='format-detection' content='telephone=no' />
<title>人车人</title><link rel="icon" href="/assets/img/titleico.ico" type="image/x-icon">
<link rel="stylesheet" href="/assets/css/common.css" />
<link rel="stylesheet" href="/assets/css/iconfont/iconfont.css" />
<style>
section .container {
	padding: 2px 0 30%;
	overflow: hidden;
}

section .container ul.ulcon li {
	padding: 1.2rem 5%;
	background-color: #fff;
	position: relative;
}

section .container ul.ulcon li .box {
	align-items: center;
	just-content: space-between;
}

section .container ul.ulcon li .icon {
	padding: 4px;
	border-radius: 6px;
	margin-right: 5%;
}

section .container ul.ulcon li .bgcolor1 {
	background-color: #ff9500;
}

section .container ul.ulcon li .bgcolor2 {
	background-color: #007aff;
}

section .container ul.ulcon li .bgcolor3 {
	background-color: #4cd964;
}

section .container ul li span {
	color: #606060;
	padding-right: 1.4rem;
	font-size: 1.6rem;
}

section .container ul.ulcon li i.rotate {
	transform: rotate(90deg);
}

section .container ul.ulcon li i {
	color: #c7c7c7;
	font-size: 2.2rem;
	transform-origin: 10px;
}

section .container ul.ulcon li .info .posbor {
	position: absolute;
	width: 100%;
	bottom: 0;
}

section .container ul.ulcon li .info i {
	font-size: 2rem;
	display: none;
	opacity: 1;
}

section .container ul.ulcon li i.fail {
	color: #fd0421;
	opacity: 0;
}

section .container ul.ulcon li i.success {
	color: #5cb85c;
	display: none;
}

section .container ul.ulcon .hideinfo {
	overflow: hidden;
	background-color: #eaeaea;
	height: 0;
}

section .container ul.ulcon .hideinfo .hideul {
	overflow: hidden;
}

section .container ul.ulcon .hideinfo .hideul p.sontab {
	padding: .4rem 2rem;
}

section .container ul.ulcon .hideinfo .hideul li {
	padding: 0;
}

section .container ul.ulcon .hideinfo .hideul li label {
	padding: 0 5%;
	width: 90%;
	align-items: center;
	height: 4.8rem;
}

section .container ul.ulcon .hideinfo .hideul li label span {
	font-size: 1.5rem;
	padding: 0;
	padding-right: .8rem;
}

section .container ul.ulcon .hideinfo .hideul li label input {
	color: #a7a7a7;
	width: 100%;
	font-size: 1.6rem;
	height: 100%;
}

section .container ul.ulcon .hideinfo .hideul li label input[type=date] {
	color: #333;
}

section .container ul.ulcon .hideinfo .hideul li label select {
	font-size: 1.6rem;
	margin-right: 1rem;
	width: 27%;
}

section .container a {
	display: block;
	height: 3.6rem;
	line-height: 3.6rem;
	width: 90%;
	text-align: center;
	margin: 3% auto;
	border-radius: 6px;
	background-color: #5cb85c;
	color: #fff;
}

section .container a.fail {
	background-color: #5cb85c;
}

section .container a:active {
	background-color: #59ab59;
}

::-webkit-input-placeholder {
	color: #fd0421;
}
</style>
<script src="/assets/js/jquery-3.1.1.min.js"></script>
</head>
<body>
	<!-- header start -->
	#@tabHead("合同申请",false)
	<!-- end header -->
	#@loadContainer()
	<section id="apply" class="visiblecon sectrans">
		<div class="container" id="container">
			<ul class="ulcon t_bor b_bor" id="ulcon">
				<li class="ac" data-basetab="bargain_loaninfos" isshow="false"
					data-submit="false">
					<div class="box flexbox">
						<div class="icon bgcolor1">
							<img src="/assets/img/icon_1.png" height="30" width="30" alt="" />
						</div>
						<div class="info flex">
							<span>贷款信息</span> <i class="iconfont success">&#xe666;</i> <i
								class="iconfont fail">&#xe701;</i>
							<div class="posbor b_bor"></div>
						</div>
						<i class="iconfont trans">&#xe61d;</i>
					</div>
				</li>
				<div class="hideinfo trans">
					<ul class="hideul">
					</ul>
					<a href="javascript:;">下一页</a>
				</div>
				<li class="ac" data-basetab="bargain_workinfos" isshow="false"
					data-submit="false">
					<div class="box flexbox">
						<div class="icon bgcolor2">
							<img src="/assets/img/icon_2.png" height="30" width="30" alt="" />
						</div>
						<div class="info flex">
							<span>工作信息</span> <i class="iconfont success">&#xe666;</i> <i
								class="iconfont fail">&#xe701;</i>
							<div class="posbor b_bor"></div>
						</div>
						<i class="iconfont trans">&#xe61d;</i>
					</div>
				</li>

				<div class="hideinfo trans">
					<ul class="hideul">
					</ul>
					<a href="javascript:;">下一页</a>
				</div>
				<li class="ac" data-basetab="bargain_incomes" isshow="false"
					data-submit="false">
					<div class="box flexbox">
						<div class="icon bgcolor2">
							<img src="/assets/img/icon_3.png" height="30" width="30" alt="" />
						</div>
						<div class="info flex">
							<span>收入信息</span> <i class="iconfont success">&#xe666;</i> <i
								class="iconfont fail">&#xe701;</i>
							<div class="posbor b_bor"></div>
						</div>
						<i class="iconfont trans">&#xe61d;</i>
					</div>
				</li>
				<div class="hideinfo trans">
					<ul class="hideul">
					</ul>
					<a href="javascript:;">下一页</a>
				</div>
				<li class="ac" data-basetab="bargain_houseinfos" isshow="false"
					data-submit="false">
					<div class="box flexbox">
						<div class="icon bgcolor3">
							<img src="/assets/img/icon_4.png" height="30" width="30" alt="" />
						</div>
						<div class="info flex">
							<span>住房信息</span> <i class="iconfont success">&#xe666;</i> <i
								class="iconfont fail">&#xe701;</i>
							<div class="posbor b_bor"></div>
						</div>
						<i class="iconfont trans">&#xe61d;</i>
					</div>
				</li>
				<div class="hideinfo trans">
					<ul class="hideul">
					</ul>
					<a href="javascript:;">下一页</a>
				</div>
				<li class="ac" data-basetab="bargain_links" isshow="false"
					data-submit="false">
					<div class="box flexbox">
						<div class="icon bgcolor3">
							<img src="/assets/img/icon_5.png" height="30" width="30" alt="" />
						</div>
						<div class="info flex">
							<span>联系人</span> <i class="iconfont success">&#xe666;</i> <i
								class="iconfont fail">&#xe701;</i>
							<div class="posbor b_bor"></div>
						</div>
						<i class="iconfont trans">&#xe61d;</i>
					</div>
				</li>
				<div class="hideinfo trans">
					<ul class="hideul">
					</ul>
				</div>
				<!-- <div class="hideinfo trans">
                    <ul class="hideul">                      
                    </ul>
                    <a href="javascript:;">下一页</a>
                </div>
                <li class="ac" data-basetab="bargain_carinfos" isshow="false" data-submit="false">
                    <div class="box flexbox">
                        <div class="icon bgcolor3">
                            <img src="/assets/img/icon_6.png" height="30" width="30" alt="" />
                        </div>
                        <div class="info flex">
                            <span>车辆信息</span>
                            <i class="iconfont success">&#xe666;</i>
                            <i class="iconfont fail">&#xe701;</i>
                        </div>
                        <i class="iconfont trans">&#xe61d;</i>
                    </div>
                </li>
                <div class="hideinfo trans">
                    <ul class="hideul">                      
                    </ul>
                </div>
            </ul> -->
				<a href='javascript:;' id='subbtn' class='subbtn'>提交</a>
		</div>
	</section>

	<!-- footer start -->
	#--#@footer(2)--#
	<!-- end footer -->

	<script src="/assets/js/fastclick.min.js"></script>
	<script src="/assets/js/jquery-3.1.1.min.js"></script>
	<script src="/assets/js/xxsg.js"></script>
	<script src="/assets/js/area.js"></script>
	<script>
        $(function(){
        	//初审是否通过
        	var orderapply = $("#nav").data("orderapply");
    		if(orderapply == 3){//拒绝
    			var msg = $("#nav").data("msg"),
    				wirtDom = $("<div style='position: absolute;width: 100%;top: 51%;left: 0;text-align: center;z-index: 99999;font-size: 1.6rem;'><i class='iconfont' style='color: #d9534f;position: absolute;top: -6rem;left: 42%;font-size: 5.6rem;'>&#xe602;</i>"+ msg +"</div>");
    			$("body").append(wirtDom);
        		$("#load-container").removeClass("load7");
        		return;
    		}else if(_x.isEmpty(orderapply) || orderapply != 5){
    			var wirtDom = $("<div style='position: absolute;width: 100%;top: 44%;left: 0;text-align: center;z-index: 99999;font-size: 1.6rem;'>初审审核中，请耐心等待...</div>");
    			$("body").append(wirtDom);
        		$("#load-container").removeClass("load7");
        		return;
    		}
        	
	       	var step = 0;
	       	$.ajax({
               "type":"post",
               "url": "/bargain/getStep",
               "dataType":"json",
               "success":function(data){                       
	               	step = data.step;
	               	if(step == 5){
                    	var tgHtml = "<div class='shtg'>"+
									 "	<div><i class='iconfont'>&#xe641;</i></div>"+
									 "	<p>审核已通过</p>"+
									 "</div>";
                    	$("#apply").removeClass("visiblecon").html(tgHtml)
						$("#load-container").removeClass("load7");
                    	return
                    }
	              	//循环添加数据
	                $("#ulcon li.ac").each(function(){
	                    var that = $(this),
	                        basetab = that.data("basetab"),
	                        ulData = that.next(".hideinfo").children("ul");
	                    getJson(ulData,basetab,that);
	                });  
	            }
            });
            //获取数据
            var tabLen = 0,
            	timer = null;
            function getJson(uldom,jsonurl,li){
            	 $.ajax({
                     "type":"post",
                     "url": "/bargain/getJson/"+jsonurl,
                     "dataType":"json",
                     "success":function(data){                       
                         dataFilter(uldom,data,li);
                     }
                 });
            }; 
			 timer = setInterval(function(){
				if(tabLen == $("#ulcon li.ac").length){
					clearInterval(timer);
					if($("#maritalStatus").val() == "已婚" || $("#maritalStatus").text() == "已婚"){
						$("#spouse_relation_box").show().find(".biaodan").addClass("empty");
						$("#linkman1_box").hide().find(".biaodan").removeClass("empty");
					}else{
						$("#spouse_relation_box").hide().find(".biaodan").removeClass("empty");
						$("#linkman1_box").show().find(".biaodan").addClass("empty");
					}
					if($("#spouse_relation_box").parents(".hideinfo").prev("li").attr("isshow") == "true"){
						$("#spouse_relation_box").parents(".hideinfo").height($("#spouse_relation_box").parents(".hideinfo")[0].scrollHeight);
					}
					if(step == 2 || step == 5){
						$("#ulcon li.ac").each(function(){
							$(this).find("i.success").show().siblings("i").hide();
						})
					}
					$("#apply").removeClass("visiblecon");
        			$("#load-container").removeClass("load7");
				}
			},600);
            
            

            //数据过滤拼接
            function dataFilter(uldom,data,nowli){
            	var position = true,
            		showSuc = true,
            		inputClz = "flex empty biaodan",
                 	show = "";
            	for(var i = 0;i < data.length;i++){
            		var paramterName = "bargainLoan."+data[i].paramterName,
	                	value = data[i].value;
	                if(_x.isEmpty(value)){
	                	value = "''";
	                }
	               	
	                var input = "<input class='flex empty biaodan' type='text' id="+ data[i].paramterName +" name="+ paramterName +" value="+value+" />";
	                
	                if(data[i].zhExpl == "职位" && value != "法人"){
	               		position = false;
	                }
	                
	               	if(!position && (data[i].paramterName == "stock" || data[i].paramterName == "unitCreateDate" || data[i].paramterName == "workersCount")){
	               		inputClz = "flex";
	               		show = "style='display:none'";
	               	}
	                //下拉选择
	                if(data[i].selectValue != ""){
	                    var selectData = data[i].selectValue.split(",");
	                    input = "<select class='empty biaodan' id="+ data[i].paramterName +" name="+ paramterName +">"+(value!="''"?"<option value="+value+">"+value+"</option>":"<option value=''>--请选择--</option>");
	                    for(var j = 0;j < selectData.length;j++){
	                    	if(value == selectData[j]){
	                            input += "<option selected='selected' value="+ selectData[j] +">"+ selectData[j] +"</option>";
	                    	}else{
	                    		input += "<option value="+ selectData[j] +">"+ selectData[j] +"</option>";
	                    	}
	                    }
	                    input += "</select>";
	                }else if(data[i].paramterName == "area"){//省市二级联动
	                	var basetab = uldom.parent().prev("li.ac").data("basetab");
	                	input = "<input class='"+ inputClz +" biaodan' type='text' name="+ paramterName +" value='"+ value +"' style='display: none;' /><select id="+ data[i].paramterName +"_pres><option value=''>--请选择--</option></select><select id="+ data[i].paramterName +"_citys><option value=''>--请选择--</option></select>";
	                }else if(data[i].paramterName == "bankArea"){//省市二级联动
	                	var basetab = uldom.parent().prev("li.ac").data("basetab");
	                	input = "<input class='"+ inputClz +" biaodan' type='text' name="+ paramterName +" value='"+ value +"' style='display: none;' /><select id="+ data[i].paramterName +"_pres><option value=''>--请选择--</option></select><select id="+ data[i].paramterName +"_citys><option value=''>--请选择--</option></select>";
	                }else{
	                    var iputType = data[i].iputType;
	                    if(iputType != ""){
	                        if(iputType == "date"){
	                            input = "<input class='"+ inputClz +"' type='date' id="+ data[i].paramterName +"  name="+ paramterName +" value="+value+" />";
	                        }else if(iputType == "post" || iputType == "number"){
	                        	if(data[i].paramterName === "resideYears"){
	                        		input = "<input class='number "+ inputClz +"' maxlength='2' type='tel' id="+ data[i].paramterName +"  name="+ paramterName +" value="+value+" data-length='"+ data[i].length +"' />";
	                        	}else{
		                            input = "<input class='number "+ inputClz +"' type='tel' id="+ data[i].paramterName +"  name="+ paramterName +" value="+value+" data-length='"+ data[i].length +"' />";
	                        	}
	                        }               
	                    }        
	                }
					
	                var unitDom = "",
	                	spanTit = "<span>"+ data[i].zhExpl +":</span>";
	                
	               	//区域不显示出来，因为文字会错位
	               /* if(data[i].paramterName == "area"){
	                	spanTit = "";
	                }*/
	                
	                //单位判断
	                if(data[i].unit && data[i].unit != ""){
	                    unitDom = "<span>"+ data[i].unit +"</span>";
	                }
	                
	                if(step == 2 || step == 4 || step == 5){
	                	input = "<span id="+ data[i].paramterName +">"+ value +"</span>";
	                }
	                
	                var html = "<li class='b_bor' "+ show +">"+
	                           "    <label class='flexbox'>"+
	                           "        <div class='icon'>"+
	                           "            <i class='iconfont fail'>&#xe602;</i>"+
	                           "            <i class='iconfont success'>&#xe641;</i>"+
	                           "        </div>"+
	                           			spanTit+
	                                    input+
	                                    unitDom+
	                           "    </label>"+
	                           "</li>";
	                //标签
	                if(data[i].sonTab != ""){
	                    html = "<li class='b_bor'>"+
	                               "    <label class='flexbox'>"+
	                               "        <div class='icon'>"+
	                               "            <i class='iconfont fail'>&#xe602;</i>"+
	                               "            <i class='iconfont success'>&#xe641;</i>"+
	                               "        </div>"+
	                               "        <span>"+ data[i].zhExpl +":</span>"+
	                                        input+
	                                        unitDom+
	                               "    </label>"+
	                               "</li>";
	                    var tabDom = $("<div class='tabbox' id='"+ data[i].paramterName +"_box' sonTab="+ data[i].sonTab +"></div>");
	                   	
	                    if(uldom.find("div[sonTab='"+data[i].sonTab +"']").length <= 0){
	                        tabDom.append("<p class='sontab'>"+ data[i].sonTab +"</p>");
	                        tabDom.append(html);
	                        uldom.append(tabDom);
	                    }else{
	                        uldom.find("div[sonTab='"+data[i].sonTab +"']").append(html);
	                    }
	                }else{              
	                    uldom.append(html);
	                }
            	}
                tabLen++;
            }
 
            //点击展开
            $("#ulcon li.ac").click(function(event) {
                var that = $(this),
                    hideDom = that.next('.hideinfo');
                if(that.attr("isshow") == "false"){
                    that.attr("isshow","true");
                    that.children(".box").children("i").addClass("rotate");
                    that.children(".box").children(".info").children(".posbor").hide();
                    var h = hideDom[0].scrollHeight;
                   	hideDom.css("height",h);

                   	//添加省份
					var presDom = $("#area_pres");
                   	if(presDom){
                   		var area = null,
                   			city = null;
                   		if(!_x.isEmpty(presDom.siblings("input").val())){
                   			area = presDom.siblings("input").val().split(",");
                   			if(area.length > 1)city = area[1];
                   		}
                   		if(presDom.children().length <= 1){
							XXarea.pres.forEach(function(obj,index){
								if(area!= null && obj == area[0]){
									presDom.append("<option selected='selected' value="+ index +'|'+ obj +">"+ obj +"</option>");
								}else{
									presDom.append("<option value="+ index +'|'+ obj +">"+ obj +"</option>");
								}
							}); 
							var citysDom = $("#area_citys");
							if(!_x.isEmpty(city)){
								citysDom.append("<option selected='selected' value='"+ city +"'>"+city+"</option>")
							}
							proChange(presDom,citysDom);           			
                   		}
                   	}
					var presDom1 = $("#bankArea_pres");
                   	if(presDom1){
                   		var area = null,
                   			city = null;
                   		if(!_x.isEmpty(presDom1.siblings("input").val())){
                   			area = presDom1.siblings("input").val().split(",");
                   			if(area.length > 1)city = area[1];
                   		}
                   		if(presDom1.children().length <= 1){
							XXarea.pres.forEach(function(obj,index){
								if(area!= null && obj == area[0]){
									presDom1.append("<option selected='selected' value="+ index +'|'+ obj +">"+ obj +"</option>");
								}else{
									presDom1.append("<option value="+ index +'|'+ obj +">"+ obj +"</option>");
								}
							}); 
							var citysDom1 = $("#bankArea_citys");
							if(!_x.isEmpty(city)){
								citysDom1.append("<option selected='selected' value='"+ city +"'>"+city+"</option>")
							}
							proChange(presDom1,citysDom1);           			
                   		}
                   	}
                }else{
                    that.attr("isshow","false");
                    that.children(".box").children("i").removeClass("rotate");
                    that.children(".box").children(".info").children(".posbor").show();
                    hideDom.css("height",0);
                }
            });

            //空判断
            function isempty(val){
                if(val == "" || val.length == 0 || val == undefined){
                    return true;
                }else{
                    return false;
                }
            };

            //是否可以进入下一页
            var mark = true,
                reg = new RegExp(' ','g');//替换空格
            $('#ulcon .hideinfo a').click(function(){
                mark = true;
                var aDom = $(this);
                
                var data = {};
                aDom.siblings(".hideul").find(".empty").each(function(){
                    var eli = aDom.parent().prev("li.ac");
                    yanzheng($(this),eli);
                    data[$(this).attr("name")] = $(this).val();
                });

                var li = aDom.parent().prev("li.ac");
                    nextli = li.next(".hideinfo").next("li.ac"),
                    hideDom = nextli.next(".hideinfo");
                    
                if(mark){
                    li.data("submit",mark);
                    li.find("i.success").show().siblings("i").hide();                   
                   		
                    if(step == 0){
                    	if($("#maritalStatus").val() == "已婚"){
           					$("#spouse_relation_box").find(".biaodan").addClass("empty");
           					$("#linkman1_box").find(".biaodan").removeClass("empty");
           				}else{
           					$("#spouse_relation_box").find(".biaodan").removeClass("empty");
           					$("#linkman1_box").find(".biaodan").addClass("empty");
           				}
                    	
                    	if(nextli.data("submit") == false){
                            nextli.attr("isshow","true");
                            nextli.children(".box").children(".info").children(".posbor").show();
                            nextli.children(".box").children("i").addClass("rotate");
                            nextli.children(".box").children(".info").children(".posbor").hide();
                            var h = hideDom[0].scrollHeight;
                            hideDom.css("height",h);
                            var bodyDom = document.body;
                            _x.scrollAnimate(bodyDom.scrollTop,nextli.offset().top,4,function(A){
                            	bodyDom.scrollTop = A;
                            });
                        }
                    	
	                    //下一页
	                    $.ajax({
	                    	type:"post",
	                    	url:"/bargain/submit",
	                    	dataType:"json",
	                    	data:data,
	                    	success:function(data){
	                    		console.log("ok")
	                    	},
	                    	error:function(){
	                    		_x.showTip("提交失败，请检查您的网络！");
	                    	}
	                    })
                    }else if(step == 2 || step == 4 || step == 5){
                    	if(aDom.hasClass("submit")){
                    		_x.showTip("提交成功！",{url: "/makeprice/uploadIndex"});
        					return;
                    	}
                    	nextli.attr("isshow","true");
                        nextli.children(".box").children(".info").children(".posbor").show();
                        nextli.children(".box").children("i").addClass("rotate");
                        nextli.children(".box").children(".info").children(".posbor").hide();
                        var h = hideDom[0].scrollHeight;
                        hideDom.css("height",h);
                        var bodyDom = document.body;
                        _x.scrollAnimate(bodyDom.scrollTop,nextli.offset().top,4,function(A){
                        	bodyDom.scrollTop = A;
                        });
                    }
                }
            });
        
            //绑定事件
            $("#ulcon .hideinfo").on("blur",".empty",function(){
                mark = true;
                var input = $(this),
                    li = input.parents(".hideinfo").prev("li.ac");
                yanzheng(input,li);
                input.parents(".hideul").find(".empty").each(function(){
                    var that = $(this);
                    if(input != that){
                        yanzheng2(that,li);
                    }
                });
                if(mark){
                    li.find("i.success").show().siblings("i").hide();
                }
            });

            //验证处理
            function yanzheng(input,li){
                var val = input.val(),
                    iconDom = input.siblings(".icon");
                if(isempty(val)){
                    iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
                    li.find("i.fail").css("opacity",1).show().siblings("i").hide();
                    input.attr("placeholder","此项不能为空！");
                    mark = false;
                    li.data("submit",mark);
                }else{
                    val = val.replace(reg,"");
                    //处理数字类型
                    if(input.hasClass("number")){                            
                        if(isNaN(val)){
                            mark = false;
                            li.data("submit",mark);
                            input.val("");
                            input.attr("placeholder","请输入数字！");
                            iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
                            li.find("i.fail").css("opacity",1).show().siblings("i").hide();
                        }else if(!_x.isEmpty(input.data("length")) && val.length != input.data("length")){
                        	mark = false;
                            li.data("submit",mark);
                            input.attr("placeholder","请输入"+ input.data("length") +"位号码或数字！");
                            iconDom.children(".success").hide().siblings(".fail").show().css("opacity",1);
                            li.find("i.fail").css("opacity",1).show().siblings("i").hide();
                        }else{
                            input.val(val);
                            iconDom.children(".fail").hide().siblings(".success").show();
                        }
                    }else{
                        input.val(val);
                        iconDom.children(".fail").hide().siblings(".success").show();
                    }
                }
            };

            //失去焦点验证处理
            function yanzheng2(input,li){
                var val = input.val();
                if(isempty(val)){
                    mark = false;
                    li.data("submit",mark);
                }else{
                    val = val.replace(reg,"");
                    //处理数字类型
                    if(input.hasClass("number")){                            
                        if(isNaN(val)){
                            mark = false;
                            li.data("submit",mark);
                        }else if(!_x.isEmpty(input.data("length")) && val.length != input.data("length")){
                        	mark = false;
                            li.data("submit",mark);
                        }
                    }
                }
            }
           
           	//联动城市
			function proChange(presDom,citysDom){
				presDom.on("change",function(){
					var that = $(this),
						data = that.val();
					citysDom[0].options.length = 1;
					if(data != ""){
						var arr = data.split("|"),
							val = arr[1],
							index = arr[0];
						XXarea.citys[index].forEach(function(obj){
							citysDom.append("<option value="+ obj +">"+ obj +"</option>");
						});
						var inputval = val +","+ citysDom.val();
                    	that.siblings(".icon").children(".fail").hide().siblings(".success").show();
						that.siblings(".empty").val(inputval);
					}else{
						that.siblings(".empty").val("");
						that.siblings(".icon").children(".success").hide().siblings(".fail").show().css("opacity",1);
                    	that.parents(".hideinfo").prev("li.ac").find("i.fail").css("opacity",1).show().siblings("i").hide();
					}				
				});
				citysDom.on("change",function(){
					var data = $(this).val(),
						inputval = presDom.val().split("|")[1] +","+ data;
					$(this).siblings(".empty").val(inputval);				
				});		
			};
			
			$("#ulcon").on("input","#position",function(){
				if($(this).val() == "法人"){
					$("#stock").addClass("empty").parents("li.b_bor").show();
					$("#unitCreateDate").addClass("empty").parents("li.b_bor").show();
					$("#workersCount").addClass("empty").parents("li.b_bor").show();
					$(this).parents(".hideinfo").height($(this).parents(".hideinfo")[0].scrollHeight);
				}else{
					$("#stock").removeClass("empty").parents("li.b_bor").hide();
					$("#unitCreateDate").removeClass("empty").parents("li.b_bor").hide();
					$("#workersCount").removeClass("empty").parents("li.b_bor").hide();
					$(this).parents(".hideinfo").height($(this).parents(".hideul").outerHeight() + $(this).parents(".hideul").siblings("a").outerHeight() + 20);
				}
			});
			
			$("#ulcon").on("change","#maritalStatus",function(){
				if($(this).val() == "已婚"){
					$("#spouse_relation_box").show().find(".biaodan").addClass("empty");
					$("#linkman1_box").hide().find(".biaodan").removeClass("empty");
				}else{
					$("#spouse_relation_box").hide().find(".biaodan").removeClass("empty");
					$("#linkman1_box").show().find(".biaodan").addClass("empty");
				}
				if($("#spouse_relation_box").parents(".hideinfo").prev("li").attr("isshow") == "true"){
					$("#spouse_relation_box").parents(".hideinfo").height($("#spouse_relation_box").parents(".hideinfo")[0].scrollHeight);
				}
			})
			
			
			//提交
			var isSubmit = true;
			$("#container").on("click","#subbtn",function(){
				if(!isSubmit)return
				isSubmit = false;
				if(step == 2 || step == 4 || step == 5){
					_x.showTip("提交成功！",{url: "/makeprice/uploadIndex"});
					return;
				}
				var mark = true;
				/*$("#ulcon .hideinfo").last().find(".empty").each(function(){
                    var eli = $(this).parents(".hideinfo").prev("li.ac");
                    yanzheng($(this),eli);
                    lastData[$(this).attr("name")] = $(this).val();
                    if(_x.isEmpty($(this).val()))mark = false;
                });*/
				$("#ulcon").find(".empty").each(function(){
					if(_x.isEmpty($(this).val())){
						mark = false;
						$(this).parents(".hideinfo").prev("li").find("i.fail").css("opacity",1).show().siblings("i").hide();
					}
				})
				
				if(mark){
					var dataArr = {}
					$("#subbtn").html("<div class='textloading'></div>")
					$("#ulcon li.ac").each(function(){
						$(this).next(".hideinfo").find(".empty").each(function(){
							dataArr[$(this).attr("name")] = $(this).val()
						})
					})
					
					$.ajax({
                    	type:"post",
                    	url:"/bargain/submit",
                    	dataType:"json",
                    	data:dataArr,
                    	success:function(data){
                    		if(data.code == 1){
                    			var ismark = true;
                				$("#ulcon .hideinfo").find(".empty").each(function(){
                					if(_x.isEmpty($(this).val())){
                						ismark = false;
                						$(this).parents(".hideinfo").prev("li").find("i.fail").css("opacity",1).show().siblings("i").hide();
                					}
                				})
                				if(ismark){
                					$.ajax({
                						type:"post",
                						url:"/bargain/submitFinal",
                						dataType:"json",
                						success:function(data){
                							if(data.code == 1){
                								_x.showTip("提交成功！",{url: "/makeprice/uploadIndex"});
                        						return;
                							}else{
                								_x.showTip("提交失败，请填写完整信息！")
                								isSubmit = true;
                								$("#subbtn").html("提交")
                							}
                						}
                					})
                				}else{
                					isSubmit = true;
    								$("#subbtn").html("提交")
                				}
        					}else{
        						_x.showTip("提交失败，请稍后重试！");
        						$("#subbtn").html("提交")
        						isSubmit = true;
        					}
                    	},
                    	error:function(){
                    		_x.showTip("提交失败，请检查您的网络！");
                    		$("#subbtn").html("提交")
                    		isSubmit = true;
                    	}
                    })
				}else{
					isSubmit = true;
					$("#subbtn").html("提交")
				}
				
			})
			
        })
    </script>

</body>
</html>
